<?php

namespace app\controller\api;

use app\BaseController;
use app\model\Package;
use app\model\PackageAttr;
use app\model\PlateformCode;
use app\model\Product;
use think\response\Json;

class Gift extends BaseController
{
    public function giftDetail(): Json
    {
        return $this->success($this->app->make(PlateformCode::class)->codeDetail());
    }

    public function giftPackDetail(): Json
    {
        return $this->success($this->app->make(PackageAttr::class)->packDetail());
    }

    public function codeRecharge(): Json
    {
        if (!$this->request->isPost()) return $this->error("请求方式错误", 74001);
        return $this->success($this->app->make(PlateformCode::class)->codeRecharge());
    }

    public function createOrder(): Json
    {
        if(!$this->request->isPost()) return $this->error("请求方式错误", 74001);
        return  $this->success($this->app->make(\app\model\Order::class)->payment());
    }

    public function productDetail(): Json
    {
        return $this->success($this->app->make(Product::class)->detail());
    }

    public function lst(): Json
    {
        return $this->success($this->app->make(Package::class)->lst());
    }

    public function idFind(): Json
    {
        return $this->success($this->app->make(Package::class)->detail());
    }
}
